import pygame.font


class Button:
    def __init__(self, alien_game, msg):
        self.screen = alien_game.screen
        self.screen_rect = self.screen.get_rect()
        self.width, self.height = 200, 50
        self.button_color = (0, 135, 0)
        self.text_color = (255, 255, 255)
        """系统字体列表"""
        """
        [
          'arial', 'arialblack', 'bahnschrift', 'calibri', 'cambria', 'cambriamath', 'candara', 'comicsansms', 'consolas', 
          'constantia', 'corbel', 'couriernew', 'ebrima', 'franklingothicmedium', 'gabriola', 'gadugi', 'georgia', 'impact',
          'inkfree', 'javanesetext', 'leelawadeeui', 'leelawadeeuisemilight', 'lucidaconsole', 'lucidasans', 'malgungothic',
          'malgungothicsemilight', 'microsofthimalaya', 'microsoftjhenghei', 'microsoftjhengheiui', 'microsoftnewtailue',
          'microsoftphagspa', 'microsoftsansserif', 'microsofttaile', 'microsoftyahei', 'microsoftyaheiui', 'microsoftyibaiti',
          'mingliuextb', 'pmingliuextb', 'mingliuhkscsextb', 'mongolianbaiti', 'msgothic', 'msuigothic', 'mspgothic', 'mvboli',
          'myanmartext', 'nirmalaui', 'nirmalauisemilight', 'palatinolinotype', 'segoemdl2assets', 'segoeprint', 'segoescript',
          'segoeui', 'segoeuiblack', 'segoeuiemoji', 'segoeuihistoric', 'segoeuisemibold', 'segoeuisemilight', 'segoeuisymbol',
          'simsun', 'nsimsun', 'simsunextb', 'sitkasmall', 'sitkatext', 'sitkasubheading', 'sitkaheading', 'sitkadisplay',
          'sitkabanner', 'sylfaen', 'symbol', 'tahoma', 'timesnewroman', 'trebuchetms', 'verdana', 'webdings', 'wingdings',
          'yugothic', 'yugothicuisemibold', 'yugothicui', 'yugothicmedium', 'yugothicuiregular', 'yugothicregular',
          'yugothicuisemilight', 'dengxian', 'fangsong', 'kaiti', 'simhei', 'holomdl2assets', 'fzshuti', 'fzyaoti',
          'lisu', 'stcaiyun', 'stfangsong', 'sthupo', 'stkaiti', 'stliti', 'stsong', 'stxihei', 'stxingkai', 'stxinwei',
          'stzhongsong', 'youyuan', 'extra', 'century', 'leelawadee', 'microsoftuighur', 'wingdings2', 'wingdings3',
          'tempussansitc', 'pristina', 'papyrus', 'mistral', 'lucidahandwriting', 'kristenitc', 'juiceitc', 'frenchscript',
          'freestylescript', 'bradleyhanditc', 'msoutlook', 'bookantiqua', 'garamond', 'monotypecorsiva', 'centurygothic'aur',
          'chiller', 'colonna', 'cooperblack', 'footlight', 'harlowsolid', 'harrington', 'hightowertext', 'jokerman',
          'kunstlerscript', 'lucidabright', 'lucidacalligraphy', 'lucidafaxregular', 'magneto', 'maturascriptcapitals',
          'modernno20', 'niagaraengraved', 'niagarasolid', 'oldenglishtext', 'onyx', 'parchment', 'playbill', 'poorrichard',
          'ravie', 'informalroman', 'showcardgothic', 'snapitc', 'stencil', 'vinerhanditc', 'vivaldi', 'vladimirscript',
          'widelatin', 'twcen', 'twcencondensed', 'script', 'rockwellextra', 'rockwellcondensed', 'rockwell', 'rage',
          'perpetuatitling', 'perpetua', 'palacescript', 'ocraextended', 'maiandragd', 'lucidasanstypewriterregular',
          'lucidasansregular', 'imprintshadow', 'haettenschweiler', 'goudystout', 'goudyoldstyle', 'gloucesterextracondensed',
          'gillsansultracondensed', 'gillsansultra', 'gillsanscondensed', 'gillsans', 'gillsansextcondensed', 'gigi',
          'franklingothicmediumcond', 'franklingothicheavy', 'franklingothicdemicond', 'franklingothicdemi',
          'franklingothicbook', 'forte', 'felixtitling', 'erasmediumitc', 'erasitc', 'erasdemiitc', 'engravers',
          'elephant', 'edwardianscriptitc', 'curlz', 'copperplategothic', 'centuryschoolbook', 'castellar', 'calisto',
          'bookmanoldstyle', 'bodonicondensed', 'bodoniblack', 'bodoni', 'blackadderitc', 'arialrounded', 'agencyfb',
          'bookshelfsymbol7', 'msreferencesansserif', 'msreferencespecialty', 'berlinsansfbdemi', 'lucidafax',
          'twcencondensedextra', 'lucidasanstypewriter', 'lucidasanstypewriteroblique', 'lucidasansroman',
          '汉仪中黑197', 'dejavusansmono', 'dejavusansmonooblique'
        ]
        """
        self.font = pygame.font.SysFont("microsoftyahei", 24)
        self.rect = pygame.Rect(0, 0, self.width, self.height)
        self.rect.center = self.screen_rect.center
        self._prep_msg(msg)

    def _prep_msg(self, msg):
        self.msg_image = self.font.render(msg, True, self.text_color, self.button_color)
        self.msg_image_rect = self.msg_image.get_rect()
        self.msg_image_rect.center = self.rect.center

    def draw_button(self):
        self.screen.fill(self.button_color, self.rect)
        self.screen.blit(self.msg_image, self.msg_image_rect)
